package com.ExcelServer.controller;


import com.ExcelServer.common.Result;
import com.ExcelServer.pojo.entity.ExcelQueryRules;
import com.ExcelServer.pojo.form.add.AddOneExcelQueryRule;
import com.ExcelServer.pojo.query.CountMapperQuery;
import com.ExcelServer.service.impl.ExcelQueryRulesServiceImpl;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.Hidden;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/se/excel/excelQueryRules")
@Hidden
@Tag(name = "（已作废）统计查询",description = "统计查询")
public class ExcelQueryController {

    @Autowired
    ExcelQueryRulesServiceImpl excelQueryRulesService;

//    @ApiOperation("增加查询统计规则")
    @Operation(summary = "增加查询统计规则",description = "增加查询统计规则")
    @PostMapping("/addCountQueryRule")
    public Result addCountQueryRule(@RequestBody AddOneExcelQueryRule addOneExcelQueryRule) {
        return excelQueryRulesService.addCountQueryRule(addOneExcelQueryRule);
    }

    @ApiOperation("删除查询统计规则")
    @Operation(summary = "删除查询统计规则",description = "删除查询统计规则")
    @DeleteMapping("/delCountQueryRuleById/{id}")
    public Result delCountQueryRule(@PathVariable String id) {
        return excelQueryRulesService.delCountQueryRule(id);
    }

    @ApiOperation("获取查询统计规则")
    @Operation(summary = "获取查询统计规则",description = "获取查询统计规则")
    @PostMapping("/getCountQueryRule")
    public Result getCountQueryRule() {
        return excelQueryRulesService.getCountQueryRule();
    }

    @ApiOperation("修改查询统计规则")
    @Operation(summary = "修改查询统计规则",description = "修改查询统计规则")
    @PostMapping("/updateCountQueryRule")
    public Result updateCountQueryRule(@RequestBody ExcelQueryRules excelQueryRules) {
        return excelQueryRulesService.updateCountQueryRule(excelQueryRules);
    }

    /***
     * 查询统计--动态查询统计方法
     ***/
    @ApiOperation("查询统计")
    @Operation(summary = "查询统计",description = "查询统计")
    @PostMapping("/countQuery")
    public Result countQuery(@RequestBody CountMapperQuery countMapperQuery) {
        return excelQueryRulesService.countQuery(countMapperQuery);
    }

}
